<?php

namespace app\admin\controller;

trait ResponseJson
{
    private function jsonResponse($code,$msg,$data){
        $result = [
          'code'=>$code,
          'msg'=>$msg,
          'data'=>$data
        ];
        return json($result);
    }

    public function SuccessResponse($msg,$data){
        return $this->jsonResponse(200,$msg,$data);
    }

    public function ReturnJson($code,$msg,$data=[]){
        return $this->jsonResponse($code,$msg,$data);
    }
}